using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace InvestmentIntelligence.DbModel.Models.Mapping
{
    public class FileUploadMap : EntityTypeConfiguration<FileUpload>
    {
        public FileUploadMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.OriginalFileName)
                .IsRequired()
                .HasMaxLength(512);

            this.Property(t => t.Path)
                .IsRequired()
                .HasMaxLength(512);

            this.Property(t => t.ContentType)
                .IsRequired()
                .HasMaxLength(512);

            // Table & Column Mappings
            this.ToTable("FileUpload", "Settings");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.OriginalFileName).HasColumnName("OriginalFileName");
            this.Property(t => t.Path).HasColumnName("Path");
            this.Property(t => t.Created).HasColumnName("Created");
            this.Property(t => t.ContentType).HasColumnName("ContentType");
        }
    }
}
